<template>
	<view>
		 <!-- v-if="loading==true" -->
		<view class="content">
			<view class="titletop" :style="'padding-top:'+statusBarHeight1+'px'">
				个人中心
			</view>
			<image :src="img_src+'bg@2x_02.png'" class="bgx" mode="widthFix" :style="'margin-top:'+(statusBarHeight1*1+45*1)+'px'"></image>
			<view class="contentz" :style="'margin-top:'+(statusBarHeight1*1+45*1)+'px'">
				<view class="avatar">
					<image src="/static/mrimg.png" class="mrimg" mode="aspectFill"></image>
					<view class="avacon">
						<view>{{user?user.name:'请登录'}}<span v-if="user">{{user.cate_types}}</span></view>
						<view>ID：{{user.id}}</view>
					</view>
					<view class="edimg" @tap="jump('/subcontract/set/set')">
						<image src="/static/edimg.png" mode="widthFix"></image>
					</view>
				</view>
				<!-- 个人资料 -->
				<view class="setxt">
					<view class="title">
						<image src="/static/setimg.png" mode="widthFix"></image>
						<span>个人资料</span>
					</view>
					<view class="txt">
						<view>
							<span>所属学校：</span>{{user.shop.name}}
						</view>
						<view v-if="user.age">
							<span>年龄：</span>{{user.age}}
						</view>
						<view>
							<span>联系电话：</span>{{user.shop.mobile}}
						</view>
						<view v-if="user.shop.work_name">
							<span>所属职务：</span>{{user.shop.work_name}}
						</view>
						<view v-if="user.shop.cate_types">
							<span>开通权限：</span>{{user.shop.cate_types}}
						</view>
					</view>
				</view>
				<view class="navlist">
					<view @tap="jump('/subcontract/set/set')">
						<image src="/static/myicon1.png" mode="widthFix"></image>
						<span>设置</span>
					</view>
					<view>
						<image src="/static/myicon2.png" mode="widthFix"></image>
						<span>关于我们</span>
					</view>
				</view>
			
			</view>
		</view>
		 <!-- <loadings  v-if="loading==false"></loadings> -->
	</view>
</template>
<script>
	const app = getApp();
	var util = require('../../utils/util.js');
	import loadings from '../../components/loading.vue';
	export default {
		components: {
			loadings
		},
		data() {
			return {
				img_src: app.globalData.img_src,
				img_url: app.globalData.img_urls,
				statusBarHeight: getApp().globalData.statusBarHeight,
				statusBarHeight1: getApp().globalData.statusBarHeight1,
				loading:false,
				user:''
			};
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad(options) {
			var that = this;
		},
		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady() {
			
		},
		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow() {
			var that = this;
			this.Getuser()
		},
		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide() {},
		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload() {},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh() {
			this.page = 0;
			uni.hideNavigationBarLoading();
			uni.stopPullDownRefresh();
		},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom() {
			this.page++;
		},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage(e) {
			
		},
		methods: {
			Getuser() {
				var that = this;
				app.globalData.api.request('User/Index', {}, "POST", 'form').then(res => {
					if (res.code == 0) {
						//console.log(res)
						this.user = res.data
					} else {
						return app.globalData.show(res.msg);
					}
				})
			},
			jump(url){
				uni.navigateTo({
					url:'/subcontract/set/set'
				})
			}
		}
	};
</script>
<style lang="scss">
	.navlist>view{
		width: 100%;
		height: 94rpx;
		display: inline-flex;
		align-items: center;
		font-family: Microsoft YaHei;
		font-weight: 400;
		font-size: 30rpx;
		color: #333333;
		border-bottom: 1px solid #DCDCDC;
	}
	.navlist>view:last-child{
		border-bottom: none;
	}
	.navlist>view>image{
		width: 20px;
		height: auto;
		margin-right: 8px;
	}
	.navlist{
		width: 700rpx;
		background-color: #fff;
		border-radius: 20rpx;
		margin-left: 25rpx;
		box-sizing: border-box;
		padding: 0px 20rpx;
	}
	.txt>view{
		width: 100%;
		height: auto;
		display: table;
		border-bottom: 1px solid #DCDCDC;
		line-height: 94rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		font-size: 30rpx;
		color: #888888;
		box-sizing: border-box;
		padding: 0px 10rpx;
	}
	.txt>view:last-child{
		border-bottom: none ;
	}
	.txt{
		width: 100%;
		height: auto;
		display: table;
	}
	.txt>view>span{
		color: #333333 !important;
		margin-right: 6px;
	}
	.title{
		width: 100%;
		height: 40px;
		display: inline-flex;
		align-items: center;
		font-family: Microsoft YaHei;
		font-weight: bold;
		font-size: 30rpx;
		color: #333333;
	}
	.title>image{
		width: 33rpx;
		margin-right: 5px;
	}
	.setxt{
		width: 700rpx;
		height: auto;
		display: table;
		border-radius: 20rpx;
		background-color: #fff;
		box-sizing: border-box;
		padding: 20rpx 20rpx;
		margin-left: 25rpx;
		padding-bottom: 5rpx !important;
		margin-bottom: 39rpx;
	}
	.edimg{
		width: auto;
		height: 40px;
		display: flex;
		justify-content: center;
		align-items: center;
		position: absolute;
		top: 50%;
		right: -7px;
		margin-top: -20px;
	}
	.edimg>image{
		width: 21px;
		height: auto;
	}
	.avatar{
		width: 646rpx;
		height: 102rpx;
		display: table;
		margin: auto;
		margin-top: 58rpx;
		margin-bottom: 58rpx;
		box-sizing: border-box;
		padding-left: 122rpx;
		position: relative;
		.mrimg{
			width: 102rpx;
			height: 102rpx;
			border-radius: 102rpx;
			position: absolute;
			top: 0px;
			left:0px;
		}
		.avacon{
			width: 100%;
			min-height: 102rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;
		}
		.avacon>view:nth-child(1){
			width: 100%;
			height: auto;
			font-family: Microsoft YaHei;
			font-weight: 400;
			font-size: 32rpx;
			color: #FFFFFF;
			margin-bottom: 5px;
		}
		.avacon>view:nth-child(1)>span{
			background-color: #0066ff;
			padding: 0px 7px;
			margin-left: 10px;
			border-radius: 5px;
			display: inline-block;
			line-height: 22px;
			font-size: 24rpx !important;
		}
		.avacon>view:nth-child(2){
			width: 100%;
			height: auto;
			font-family: Microsoft YaHei;
			font-weight: 400;
			font-size: 24rpx;
			color: #FFFFFF;
		}
	}
	.contentz{
		width:100%;
		height:auto;
		display:table;
		position: absolute;
		top: 0px;
		left: 0px;
		z-index: 1;
	}
	.bgx{
		width: 100%;
		height: auto;
		display: table;
	}
	.titletop{
		width:100%;
		height:auto;
		display:table;
		position: fixed;
		text-align: center;
		top: 0px;
		left: 0px;
		z-index: 10;
		background: url($IMG_URL+'bg@2x_01.png')no-repeat;
		background-size: 100% 100%;
		box-sizing: border-box;
		padding: 0px 44rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		font-size: 38rpx;
		color: #FFFFFF;
		line-height: 45px;
	}
	.content{
		width: 100%;
		height:auto;
		display: table;
		position: relative;
		z-index: 10;
	}
	page{
		background: #f4f4f4;
	}
</style>